<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://sduept.security.el/func"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml">
	<ui:define name="head">
		<title>#{request.getParameter('selectName')} 保护反措执行情况</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
.dataTable th {
	white-space: nowrap !important;
}

.nav-tabs-custom>.tab-content {
	height: 780px;
}

#title {
	height: 60px;
	padding-top: 10px;
}
</style>
	</ui:define>
	<ui:define name="content">
		<div class='full-center-content-scroll-noheader'>
			<div class="nav-tabs-custom">
				<ul class="nav nav-tabs pull-left">
					<li class="active"><a href="#totalCaseTab" data-toggle="tab">总体情况</a></li>
					<li><a href="#detailCaseTab" data-toggle="tab"
						id="detailTabPanel">具体情况</a></li>
				</ul>
				<div class="tab-content no-padding">
					<div class="chart tab-pane active" id="totalCaseTab"
						style="position: relative">
						<div class="row">
							<div class="col-xs-12">
								<div class="col-lg-6 col-xs-6 no-padding">
									<div class="box box-primary">
										<div class="box-header with-border">
											<h4 class='box-title'>反措项目完成率</h4>
										</div>
										<div class="box-body">
											<div id="totalDatas" style="height: 500px;"></div>
										</div>
									</div>
								</div>
								<div class="col-lg-6 col-xs-6 no-padding">
									<div class="box box-primary">
										<div class="box-header with-border">
											<h4 class='box-title'>反措项目</h4>
											<p:commandButton value="数据维护" icon="ui-icon-document"
												rendered="#{s:hasPermission(session,'tjfx_bhfcfx_ztqksjwh')}"
												style="float:right" onclick="PF('itemDlg').show()" />
										</div>
										<div class="box-body">
											<div id="itemsid" class="box-body"
												style="height: 500px; overflow: auto"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<div class="col-lg-12 col-xs-12 no-padding">
									<div class="box box-primary ">
										<div class="box-header with-border">
											<h4 class='box-title'>各分子公司反措完成情况</h4>
										</div>
										<div class="box-body">
											<div id="subCompanyDatas" style="height: 500px;"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="chart tab-pane" id="detailCaseTab"
						style="position: relative">
						<div class="row">
							<div class="col-xs-12">
								<div id="d1" class="box box-primary">
									<div class="box-header with-border">
										<p:outputLabel value="反措项目 ：" />
										<h:selectOneMenu id="protectCounterMeasureName_id"
											value="#{counterMeasuresController.protectCounterMeasureName}"
											style="width:700px;margin-right:20px;height:30px">
											<p:ajax event="change"
												oncomplete="getSelectedMeasureDatas();" />
											<f:selectItems
												value="#{counterMeasuresController.protectCounterMeasureNames}" />
										</h:selectOneMenu>
										<p:commandButton value="数据维护" icon="ui-icon-document"
											actionListener="#{counterMeasuresController.reload()}"
											rendered="#{s:hasPermission(session,'tjfx_bhfcfx_jtqksjwh')}"
											style="float:right" onclick="PF('itemDetailDlg').show()"
											update="itemDetailForm" />
									</div>
									<div class="box-body">
										<div id="measureBars" style="height: 650px;"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 反措项目数据维护 -->
		<p:dialog widgetVar="itemDlg" header="反措项目数据维护" modal="true"
			id="itemDlg" width="1200" height="600">
			<h:form id="itemForm">
				<p:toolbar id="toolbar1">
					<f:facet name="left">
						<p:commandButton value="新建" icon="fa fa-plus"
							actionListener="#{counterMeasuresController.preCreatProtectCounterMeasure}"
							oncomplete="PF('itemCreateDlg').show()" update="itemCreateForm" />
						<p:commandButton value="编辑" icon="fa fa-pencil" id="edit1"
							actionListener="#{counterMeasuresController.editProtectCounterMeasure}"
							disabled="#{counterMeasuresController.selectedProtectCounterMeasure.id == null}"
							oncomplete="PF('itemCreateDlg').show()"
							update="itemCreateForm measureTable" />
						<p:commandButton value="删除" icon="fa fa-trash" id="delt1"
							actionListener="#{counterMeasuresController.deleteProtectCounterMeasure}"
							disabled="#{counterMeasuresController.selectedProtectCounterMeasure.id == null}"
							update="measureTable edit1 delt1 :itemDetailForm:msgs">
							<p:confirm header="提示" message="确定删除记录吗？" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:dataTable id="measureTable" var="measure"
					value="#{counterMeasuresController.protectCounterMeasures}" rowIndexVar="ite"
					paginator="true" emptyMessage="无记录" rowKey="#{measure.id}" rows="20"
					selection="#{counterMeasuresController.selectedProtectCounterMeasure}"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom"
					style="text-align:left;margin-top:3px">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{counterMeasuresController.protectCounterMeasures.size()} 条记录" style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio" update="itemForm:edit1 itemForm:delt1" listener="#{counterMeasuresController.onRowSelectRadio}" />
					<p:column selectionMode="single" width="60" style="text-align:center" />
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="反措项目内容" width="70%">
						<p:outputLabel value="#{measure.name}" />
					</p:column>
					<p:column headerText="反措项目开始日期" width="15%">
						<h:outputText value="#{measure.startDate}">
							<f:convertDateTime pattern="yyyy-MM-dd" />
						</h:outputText>
					</p:column>
					<p:column headerText="反措项目截止日期" width="15%">
						<h:outputText value="#{measure.endDate}">
							<f:convertDateTime pattern="yyyy-MM-dd" />
						</h:outputText>
					</p:column>
				</p:dataTable>
			</h:form>
		</p:dialog>
		<!-- 新建、编辑反措项目内容 -->
		<p:dialog widgetVar="itemCreateDlg" header="反措项目" width="400"
			height="250">
			<h:form id="itemCreateForm">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{counterMeasuresController.saveProtectCounterMeasure}"
							oncomplete="PF('itemCreateDlg').hide()"
							update=":itemForm:edit1 :itemForm:delt1 :itemDetailForm:msgs :itemForm:measureTable :protectCounterMeasureName_id ">
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:outputPanel style="text-align:center;">
					<p:panelGrid columns="2">
						<h:outputText value="反措项目内容" />
						<h:inputTextarea label="content"
							value="#{counterMeasuresController.protectCounterMeasure.name}" />
						<h:outputText value="反措项目开始时间：" />
						<p:calendar id="date" navigator="true"
							value="#{counterMeasuresController.protectCounterMeasure.startDate}"
							pattern="yyyy-MM-dd" />
						<h:outputText value="反措项目截止时间：" />
						<p:calendar id="date1" navigator="true"
							value="#{counterMeasuresController.protectCounterMeasure.endDate}"
							pattern="yyyy-MM-dd" />
					</p:panelGrid>
				</p:outputPanel>
			</h:form>
		</p:dialog>

		<!-- 各分子公司反措完成详情 -->
		<p:dialog widgetVar="itemDetailDlg" header="各分子公司反措完成详情数据维护"
			modal="true" id="itemDetailDlg" width="1300" height="650"
			onHide="getSelectedMeasureDatas();">
			<h:form id="itemDetailForm">
				<div class="box box-solid with-border">
					<div class="box-header">
						<p:outputLabel value="反措项目 ：" />
						<h:selectOneMenu value="#{counterMeasuresController.measureName}"
							style="width:300px;margin-right:20px;height:30px" id="measureName">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems
								value="#{counterMeasuresController.protectCounterMeasureNames}" />
						</h:selectOneMenu>
						<p:outputLabel value="公司 ：" />
						<h:selectOneMenu value="#{counterMeasuresController.subCompany}"
							style="width:130px;margin-right:20px;height:30px" id="subCompany">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems value="#{counterMeasuresController.subCompanys}" />
						</h:selectOneMenu>
						<p:commandButton value="查询" icon="ui-icon-search"
							style="margin-right:10px"
							actionListener="#{counterMeasuresController.queryByCondition}"
							update="itemDetailForm:measureDetailTable" />
						<p:commandButton value="重置" icon="ui-icon-refresh"
							style="margin-right:10px"
							actionListener="#{counterMeasuresController.reset()}"
							update="measureDetailTable measureName subCompany" />
					</div>
				</div>
				<p:toolbar id="toolbar1">
					<f:facet name="left">
						<p:growl id="msgs" showDetail="true" />
						<p:commandButton value="新建" icon="fa fa-plus"
							actionListener="#{counterMeasuresController.preCreatProtectCounterMeasureSub}"
							oncomplete="PF('itemDetailCreateDlg').show()"
							update="itemDetailCreateForm itemDetailForm:measureDetailTable" />
						<p:commandButton value="编辑" icon="fa fa-pencil" id="edit"
							actionListener="#{counterMeasuresController.editProtectCounterMeasureSub}"
							disabled="#{counterMeasuresController.selectProtectCounterMeasureSub.id == null}"
							oncomplete="PF('itemDetailEditDlg').show()"
							update="itemDetailEditForm measureDetailTable" />
						<p:commandButton value="删除" icon="fa fa-trash" id="delt"
							actionListener="#{counterMeasuresController.deleteProtectCounterMeasureSub}"
							disabled="#{counterMeasuresController.selectProtectCounterMeasureSub.id == null}"
							update="measureDetailTable edit delt msgs">
							<p:confirm header="提示" message="确定删除记录吗？" icon="ui-icon-alert" />
						</p:commandButton>
						<p:commandButton value="下载模板" ajax="false"
							icon="ui-icon-arrowthick-1-s"
							actionListener="#{counterMeasuresController.fileDownloadView()}">
							<p:fileDownload value="#{counterMeasuresController.templateFile}" />
						</p:commandButton>
						<p:commandButton id="newStatBtn" value="上传文件"
							actionListener="#{counterMeasuresController.chooseEquipment}">
							<p:ajax event="dialogReturn"
								update="itemDetailForm:msgs itemDetailForm:measureDetailTable"
								listener="#{counterMeasuresController.onSelectorChosen}" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:dataTable id="measureDetailTable" var="measure"
					value="#{counterMeasuresController.protectCounterMeasureSubs}" rowIndexVar="ite"
					paginator="true" emptyMessage="无记录" rowKey="#{measure.id}" rows="15"
					selection="#{counterMeasuresController.selectProtectCounterMeasureSub}"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,30,50" paginatorPosition="bottom"
					style="text-align:left;margin-top:3px">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{counterMeasuresController.protectCounterMeasureSubs.size()} 条记录" style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio" listener="#{counterMeasuresController.onRowSelect}"
						update="itemDetailForm:edit itemDetailForm:delt :itemDetailCreateForm" />
					<p:column selectionMode="single" width="60" style="text-align:center" />
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="反措项目内容" width="70%" sortBy="#{measure.pid}">
						<p:outputLabel
							value="#{counterMeasuresController.getProtectCounterMeasureName(measure.pid)}" />
					</p:column>
					<p:column headerText="公司" width="15%">
						<p:outputLabel value="#{measure.company}" />
					</p:column>
					<p:column headerText="应反措" width="10%">
						<p:outputLabel value="#{measure.amount}" />
					</p:column>
					<p:column headerText="已反措" width="10%">
						<p:outputLabel value="#{measure.ontimeAmount}" />
					</p:column>
					<p:column headerText="年" width="10%">
						<p:outputLabel value="#{measure.year}" />
					</p:column>
				</p:dataTable>
			</h:form>
		</p:dialog>

		<!-- 新建各分子公司反措详情 -->
		<p:dialog widgetVar="itemDetailCreateDlg" header="各分子公司反措完成情况"
			width="500" height="350" onHide="getSelectedMeasureDatas();">
			<h:form id="itemDetailCreateForm">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{counterMeasuresController.saveProtectCounterMeasureSub}"
							oncomplete="PF('itemDetailCreateDlg').hide()"
							update=":itemDetailForm:msgs :itemDetailForm:measureDetailTable :itemDetailForm:delt :itemDetailForm:edit">
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:outputPanel>
					<p:panelGrid columns="2">
						<h:outputText value="反措项目内容" />
						<p:autoComplete forceSelection="true" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureName}"
							completeMethod="#{counterMeasuresController.completeCounterMeasures}"
							dropdown="true">
							<p:ajax event="itemSelect" update="itemDetailCreateForm"
								listener="#{counterMeasuresController.getCounterMeasure}" />
						</p:autoComplete>
						<h:outputText value="公司" />
						<p:autoComplete style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.company}"
							completeMethod="#{counterMeasuresController.completeSubCompany}"
							dropdown="true" />
						<h:outputText value="年份" />
						<h:selectOneMenu style="width:100%;height:30px"
							value="#{counterMeasuresController.protectCounterMeasureSub.year}">
							<f:selectItem itemLabel="总数" itemValue="0" />
							<f:selectItems value="#{counterMeasuresController.years}" />
						</h:selectOneMenu>
						<h:outputText value="应反措" />
						<p:inputText label="content" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.amount}" />
						<h:outputText value="已反措" />
						<p:inputText label="content" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.ontimeAmount}" />
					</p:panelGrid>
				</p:outputPanel>
			</h:form>
		</p:dialog>

		<!-- 编辑各分子公司反措详情 -->
		<p:dialog widgetVar="itemDetailEditDlg" header="各分子公司反措完成情况"
			width="500" height="350">
			<h:form id="itemDetailEditForm">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{counterMeasuresController.saveProtectCounterMeasureSub}"
							oncomplete="PF('itemDetailEditDlg').hide()"
							update=":itemDetailForm:msgs :itemDetailForm:measureDetailTable :itemDetailForm:delt :itemDetailForm:edit">
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:outputPanel>
					<p:panelGrid columns="2">
						<h:outputText value="反措项目内容" />
						<p:inputText label="content" readonly="true" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureName}" />
						<h:outputText value="公司" />
						<p:autoComplete style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.company}"
							completeMethod="#{counterMeasuresController.completeSubCompany}"
							dropdown="true" />
						<h:outputText value="年份" />
						<p:inputText label="content" readonly="true" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.year}" />
						<h:outputText value="应反措" />
						<p:inputText label="content" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.amount}" />
						<h:outputText value="已反措" />
						<p:inputText label="content" style="width:100%"
							value="#{counterMeasuresController.protectCounterMeasureSub.ontimeAmount}" />
					</p:panelGrid>
				</p:outputPanel>
			</h:form>
		</p:dialog>
		<h:inputHidden id="lineName"
			value="#{request.getParameter('selectName')}"></h:inputHidden>
	</ui:define>

	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/js/tables/mytable.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/charts.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script
			src="#{request.contextPath}/resources/js/mycharts/categoryBarChart.js"></script>
		<script src="#{request.contextPath}/resources/js/array-util.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/jQueryUI/jquery-ui.js"></script>
		<script
			src="#{request.contextPath}/resources/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
		<script
			src="#{request.contextPath}/resources/bootstrap/js/bootstrap3-typeahead.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/pinyin/pinyin_dict_firstletter.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/pinyin/pinyinUtil.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/bootstrap-select/bootstrap-select.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/extensions/Buttons/dataTables.buttons.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/extensions/Buttons/buttons.colVis.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/timeline.js"></script>
		<script
			src="#{request.contextPath}/resources/js/mycharts/radarChart.js"></script>
		<script src="countermeasures.js"></script>
	</ui:define>
</ui:composition>